﻿namespace MicroCloud.Utils
{
    /// <summary>
    /// 表达式数据
    /// </summary>
    public class CronData
    {
        /// <summary>
        /// 初始化一个表达式数据的新实例
        /// </summary>
        public CronData()
        {
            for (int i = 0; i < 60; i++)
            {
                Seconds[i] = 0;
                Minutes[i] = 0;
            }
            for (int i = 0; i < 24; i++)
            {
                Hours[i] = 0;
            }
            for (int i = 0; i < 31; i++)
            {
                Days[i] = 0;
            }
            for (int i = 0; i < 12; i++)
            {
                Month[i] = 0;
            }
            for (int i = 0; i < 7; i++)
            {
                Weeks[i] = 0;
            }
            for (int i = 0; i < 80; i++)
            {
                Year[i] = 0;
            }
        }

        #region 属性
        #region "获取或设置 秒位，表示1-60秒"
        private int[] _Seconds = new int[60];
        /// <summary>
        /// 获取或设置 秒位，表示1-60秒
        /// </summary>
        public int[] Seconds { get => _Seconds; set => _Seconds = value; }
        #endregion

        #region "获取或设置 分位，表示1-60分"
        private int[] _Minutes = new int[60];
        /// <summary>
        /// 获取或设置 分位，表示1-60分
        /// </summary>
        public int[] Minutes { get => _Minutes; set => _Minutes = value; }
        #endregion

        #region "获取或设置 小时位，表示1-24小时"
        private int[] _Hours = new int[24];
        /// <summary>
        /// 获取或设置 小时位，表示1-24小时
        /// </summary>
        public int[] Hours { get => _Hours; set => _Hours = value; }
        #endregion

        #region "获取或设置 天位，表示1-31天"
        private int[] _Days = new int[31];
        /// <summary>
        /// 获取或设置 天位，表示1-31天
        /// </summary>
        public int[] Days { get => _Days; set => _Days = value; }
        #endregion

        #region "获取或设置 月位，表示1-12月"
        private int[] _Month = new int[12];
        /// <summary>
        /// 获取或设置 月位，表示1-12月
        /// </summary>
        public int[] Month { get => _Month; set => _Month = value; }
        #endregion

        #region "获取或设置 星期位，表示星期1-星期天"
        private int[] _Weeks = new int[7];
        /// <summary>
        /// 获取或设置 星期位，表示星期1-星期天
        /// </summary>
        public int[] Weeks { get => _Weeks; set => _Weeks = value; }
        #endregion

        #region "获取或设置 年位，表示2019-2099年"
        private int[] _Year = new int[80];
        /// <summary>
        /// 获取或设置 年位，表示2019-2099年
        /// </summary>
        public int[] Year { get => _Year; set => _Year = value; }
        #endregion

        #endregion

        #region 方法
        /// <summary>
        /// 初始化星期和天
        /// </summary>
        public void Init()
        {
            for (int i = 0; i < 7; i++)
            {
                Weeks[i] = 0;
            }
            for (int i = 0; i < 31; i++)
            {
                Days[i] = 0;
            }
        }

        #endregion

    }

}
